//
//  PersonChannelPosts.m
//  TestApplication
//
//  Created by Hanlingyu on 16/09/16
//  Copyright (c) ltq. All rights reserved.
//

#import "PersonChannelPosts.h"
#import "PersonChannelImg.h"
#import "PersonChannelTag.h"
#import "PersonChannelChannel.h"
#import "ChannelVoice.h"
@implementation PersonChannelPosts
- (void)setValue:(id)value forKey:(NSString *)key {
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"img"]) {
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            PersonChannelImg *img = [PersonChannelImg modelWithDic:dic];
            [array addObject:img];
        }
        _img = array;
    } else if ([key isEqualToString:@"channel"]) {
        _channel = [PersonChannelChannel modelWithDic:value];
    } else if ([key isEqualToString:@"tag"]) {
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            PersonChannelTag *tag = [PersonChannelTag modelWithDic:dic];
            [array addObject:tag];
        }
        _tag = array;
    } else if ([key isEqualToString:@"voice"]) {
//        NSLog(@"有Voice");
        ChannelVoice *voice = [ChannelVoice modelWithDic:value];
        _voice = voice;
    }
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    [super setValue:value forUndefinedKey:key];
    if ([key isEqualToString:@"id"]) {
        _ID = value;
    }
}


+ (NSDictionary *)objectClassInArray{
    return @{@"img" : [PersonChannelImg class], @"tag" : [PersonChannelTag class]};
}

@end
